C#中实现对sqlite数据库的存储操作,可以添加数据和查询数据
//先显示holtel
int RecordCount = 0;
StringBuilder asshotel = new StringBuilder("");
StringBuilder asshotel2 = new StringBuilder("");
asshotel.Append("Select count(1) as co from hotel");
DataSet dshotel = new DataSet();
dshotel = DbHelperSQLite.Query(asshotel.ToString());
RecordCount = Int32.Parse(dshotel.Tables[0].Rows[0][0].ToString());//获取数据的记录条数
asshotel2.Append("select hotelname from hotel");
DataSet dshotel2 = new DataSet();
dshotel2 = DbHelperSQLite.Query(asshotel2.ToString());
for (int i = 0; i < RecordCount; i )
{
DropDLhotel.Items.Add(new ListItem(dshotel2.Tables[0].Rows[i][0].ToString(), Convert.ToString(i)));
}
评论